// javamaps
// Copyright (c) 2010 Lup Gratian
package Rendering;
import Core.*;

public final class Action {
    ActionType type_;
    IObjectInfo objectInfo_;
    boolean valid_;

    /*
     * Constructori.
     */
    public Action(ActionType type) {
        type_ = type;
        valid_ = true;
    }

    public Action(ActionType type, IObjectInfo info) {
        this(type);
        objectInfo_ = info;
    }

    public static Action ObjectSelected(IObjectInfo info) {
        return new Action(ActionType.ObjectSelected, info);
    }

    public static Action ObjectMoved(IObjectInfo info) {
        return new Action(ActionType.ObjectMoved, info);
    }

    public static Action ObjectHovered(IObjectInfo info) {
        return new Action(ActionType.ObjectHovered, info);
    }

    public static Action ObjectAdded(IObjectInfo info) {
        return new Action(ActionType.ObjectAdded, info);
    }
    
    public static Action ObjectRemoved(IObjectInfo info) {
        return new Action(ActionType.ObjectRemoved, info);
    }

    public static Action MapPanned(IObjectInfo info) {
        return new Action(ActionType.MapPanned, info);
    }

    public static Action MapZoomed(IObjectInfo info) {
        return new Action(ActionType.MapZoomed, info);
    }

    /*
     * Metode publice.
     */
    public ActionType Type() { return type_; }
    
    public IObjectInfo ObjectInfo() { return objectInfo_; }
    public void SetObjectInfo(IObjectInfo value) { objectInfo_ = value; }

    public boolean Valid() { return valid_; }
    public void SetValid(boolean value) { valid_ = value; }

    @Override
    public String toString() {
        return "Action: " + type_.toString() + " - " + objectInfo_.Type().toString();
    }
}